
These are the Zip and Unzip options to be used in the BW Zip Compress OCX

The sample application distributed with the OCX already have the most used commands inside it

Notice that not all the arguments can be used in the OCX , but you is welcome to test all

Zip and Unzip Options

These are the options to be passed to the Zip and Unzip functions using the Options argument , these arguments derived from the zip.exe and unzip.exe files by Infozip.




ZIP(1L)                                                   ZIP(1L)


NAME
       zip,  zipcloak,  zipnote,  zipsplit - package and compress
       (archive) files

SYNOPSIS
       zip     [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$]     [-b path]
       [-n suffixes]  [-t mmddyyyy]  [-tt mmddyyyy]  [  zipfile [
       file1 file2 ...]] [-xi list]

       zipcloak [-dhL] [-b path] zipfile

       zipnote [-hwL] [-b path] zipfile

       zipsplit [-hiLpst] [-n size] [-b path] zipfile

DESCRIPTION
       zip is a compression and file packaging utility for  Unix,
       VMS,  MSDOS, OS/2, Windows NT, Minix, Atari and Macintosh,
       Amiga and Acorn RISC OS.

       It is analogous to a  combination  of  the  UNIX  commands
       tar(1)  and compress(1) and is compatible with PKZIP (Phil
       Katz's ZIP for MSDOS systems).

       A companion program  (unzip(1L)),  unpacks  zip  archives.
       The zip and unzip(1L) programs can work with archives pro-
       duced by PKZIP,  and  PKZIP  and  PKUNZIP  can  work  with
       archives  produced  by zip.  zip version 2.3 is compatible
       with PKZIP 2.04.  Note that PKUNZIP  1.10  cannot  extract
       files  produced  by  PKZIP  2.04  or zip 2.3. You must use
       PKUNZIP 2.04g  or  unzip  5.0p1  (or  later  versions)  to
       extract them.

       For a brief help on zip and unzip, run each without speci-
       fying any parameters on the command line.

       The program is useful for packaging a  set  of  files  for
       distribution;  for  archiving  files;  and for saving disk
       space by temporarily compressing unused files or  directo-
       ries.

       The  zip  program puts one or more compressed files into a
       single zip archive, along with information about the files
       (name,  path, date, time of last modification, protection,
       and check  information  to  verify  file  integrity).   An
       entire  directory  structure  can  be  packed  into  a zip
       archive with a single command.  Compression ratios of  2:1
       to 3:1 are common for text files.  zip has one compression
       method (deflation) and can also store files  without  com-
       pression.  zip automatically chooses the better of the two
       for each file to be compressed.

       When given the name of an existing zip archive,  zip  will
       replace  identically  named  entries in the zip archive or



Info-ZIP              14 August 1999 (v2.3)                     1





ZIP(1L)                                                   ZIP(1L)


       add entries for new names.  For example, if foo.zip exists
       and  contains  foo/file1  and foo/file2, and the directory
       foo contains the files foo/file1 and foo/file3, then:

              zip -r foo foo

       will replace foo/file1 in foo.zip  and  add  foo/file3  to
       foo.zip.    After   this,   foo.zip   contains  foo/file1,
       foo/file2, and foo/file3, with  foo/file2  unchanged  from
       before.

       If  the  file  list is specified as -@, [Not on MacOS] zip
       takes the list of input files from standard input.   Under
       UNIX,  this  option can be used to powerful effect in con-
       junction  with  the  find(1)  command.   For  example,  to
       archive  all  the  C source files in the current directory
       and its subdirectories:

              find . -name "*.[ch]" -print | zip source -@

       (note that the pattern must be quoted to  keep  the  shell
       from  expanding  it).   zip will also accept a single dash
       ("-") as the zip file name, in which case  it  will  write
       the zip file to standard output, allowing the output to be
       piped to another program. For example:

              zip -r - . | dd of=/dev/nrst0 obs=16k

       would write the zip output directly to  a  tape  with  the
       specified  block  size  for  the purpose of backing up the
       current directory.

       zip also accepts a single dash ("-") as the name of a file
       to be compressed, in which case it will read the file from
       standard input, allowing zip to take  input  from  another
       program. For example:

              tar cf - . | zip backup -

       would  compress the output of the tar command for the pur-
       pose of backing up the current directory.  This  generally
       produces  better  compression  than  the  previous example
       using the -r option, because zip  can  take  advantage  of
       redundancy between files. The backup can be restored using
       the command

              unzip -p backup | tar xf -

       When no zip file name is given and stdout is not a  termi-
       nal,  zip  acts as a filter, compressing standard input to
       standard output.  For example,

              tar cf - . | zip | dd of=/dev/nrst0 obs=16k




Info-ZIP              14 August 1999 (v2.3)                     2





ZIP(1L)                                                   ZIP(1L)


       is equivalent to

              tar cf - . | zip - - | dd of=/dev/nrst0 obs=16k

       zip archives created in this manner can be extracted  with
       the program funzip which is provided in the unzip package,
       or by gunzip which is provided in the  gzip  package.  For
       example:

       dd if=/dev/nrst0  ibs=16k | funzip | tar xvf -

       When  changing  an  existing zip archive, zip will write a
       temporary file with the new contents, and only replace the
       old  one  when the process of creating the new version has
       been completed without error.

       If the name of the zip archive does not contain an  exten-
       sion,  the  extension  .zip  is added. If the name already
       contains an extension other than .zip the existing  exten-
       sion is kept unchanged.

OPTIONS
       -a     [Systems using EBCDIC] Translate file to ASCII for-
              mat.

       -A     Adjust self-extracting executable archive.  A self-
              extracting   executable   archive   is  created  by
              prepending the SFX stub to an existing archive. The
              -A  option  tells  zip  to adjust the entry offsets
              stored in the archive to  take  into  account  this
              "preamble" data.

       Note: self-extracting archives for the Amiga are a special
       case.  At present, only the Amiga port of Zip  is  capable
       of adjusting or updating these without corrupting them. -J
       can be used to remove the SFX stub if other  updates  need
       to be made.

       -B     [VM/CMS  and  MVS]  force  file  to  be read binary
              (default is text).

       -Bn    [TANDEM] set Edit/Enscribe formatting options  with
              n defined as
              bit  0: Don't add delimiter (Edit/Enscribe)
              bit  1:  Use  LF  rather  than  CR/LF  as delimiter
              (Edit/Enscribe)
              bit  2: Space fill record to maximum record  length
              (Enscribe)
              bit  3: Trim trailing space (Enscribe)
              bit  8:  Force 30K (Expand) large read for unstruc-
              tured files

       -b path
              Use  the  specified  path  for  the  temporary  zip



Info-ZIP              14 August 1999 (v2.3)                     3





ZIP(1L)                                                   ZIP(1L)


              archive. For example:

                     zip -b /tmp stuff *

              will put the temporary zip archive in the directory
              /tmp, copying over stuff.zip to the current  direc-
              tory  when  done.  This  option is only useful when
              updating an existing archive, and the  file  system
              containing  this  old  archive does not have enough
              space to hold both old and new archives at the same
              time.

       -c     Add  one-line  comments for each file.  File opera-
              tions (adding, updating) are done  first,  and  the
              user  is  then  prompted for a one-line comment for
              each file.  Enter the comment followed  by  return,
              or just return for no comment.

       -d     Remove  (delete)  entries  from a zip archive.  For
              example:

                     zip -d foo foo/tom/junk foo/harry/\* \*.o

              will remove the  entry  foo/tom/junk,  all  of  the
              files  that  start  with foo/harry/, and all of the
              files that end with .o (in any  path).   Note  that
              shell  pathname  expansion  has been inhibited with
              backslashes, so that zip  can  see  the  asterisks,
              enabling  zip  to  match on the contents of the zip
              archive instead of  the  contents  of  the  current
              directory.

              Under  MSDOS,  -d is case sensitive when it matches
              names in the zip archive.  This requires that  file
              names  be entered in upper case if they were zipped
              by PKZIP on an MSDOS system.

       -df    [MacOS] Include only data-fork of files zipped into
              the  archive.   Good for exporting files to foreign
              operating-systems.  Resource-forks will be  ignored
              at all.

       -D     Do not create entries in the zip archive for direc-
              tories.  Directory entries are created  by  default
              so  that  their  attributes can be saved in the zip
              archive.  The environment variable  ZIPOPT  can  be
              used  to  change  the  default options. For example
              under Unix with sh:

                     ZIPOPT="-D"; export ZIPOPT

              (The variable ZIPOPT can be  used  for  any  option
              except  -i and -x and can include several options.)
              The option -D is a shorthand for -x  "*/"  but  the



Info-ZIP              14 August 1999 (v2.3)                     4





ZIP(1L)                                                   ZIP(1L)


              latter cannot be set as default in the ZIPOPT envi-
              ronment variable.

       -e     Encrypt the contents of the  zip  archive  using  a
              password  which  is  entered  on  the  terminal  in
              response to a prompt (this will not be  echoed;  if
              standard  error is not a tty, zip will exit with an
              error).  The password prompt is  repeated  to  save
              the user from typing errors.

       -E     [OS/2]  Use  the  .LONGNAME  Extended Attribute (if
              found) as filename.

       -f     Replace (freshen) an  existing  entry  in  the  zip
              archive  only if it has been modified more recently
              than the version already in the zip archive; unlike
              the update option (-u) this will not add files that
              are not already in the zip archive.  For example:

                     zip -f foo

              This command should be run from the same  directory
              from  which the original zip command was run, since
              paths stored in zip archives are always relative.

              Note that  the  timezone  environment  variable  TZ
              should  be  set  according to the local timezone in
              order for the -f , -u and -o options to  work  cor-
              rectly.

              The  reasons  behind  this  are somewhat subtle but
              have to do with the differences between  the  Unix-
              format  file  times (always in GMT) and most of the
              other operating systems (always local time) and the
              necessity  to  compare the two.  A typical TZ value
              is ``MET-1MEST'' (Middle European time  with  auto-
              matic  adjustment  for  ``summertime''  or Daylight
              Savings Time).

       -F     Fix the zip archive. This option  can  be  used  if
              some portions of the archive are missing. It is not
              guaranteed to work, so you MUST make  a  backup  of
              the original archive first.

              When  doubled  as in -FF the compressed sizes given
              inside the damaged archive are not trusted and  zip
              scans for special signatures to identify the limits
              between the archive members. The single -F is  more
              reliable  if  the  archive is not too much damaged,
              for example if it has only been truncated,  so  try
              this option first.

              Neither option will recover archives that have been
              incorrectly transferred in ascii  mode  instead  of



Info-ZIP              14 August 1999 (v2.3)                     5





ZIP(1L)                                                   ZIP(1L)


              binary.  After  the  repair, the -t option of unzip
              may show that some files have a bad CRC. Such files
              cannot  be  recovered; you can remove them from the
              archive using the -d option of zip.

       -g     Grow (append to) the specified zip archive, instead
              of creating a new one. If this operation fails, zip
              attempts to restore the  archive  to  its  original
              state.  If the restoration fails, the archive might
              become  corrupted.  This  option  is  ignored  when
              there's  no  existing  archive or when at least one
              archive member must be updated or deleted.

       -h     Display the zip help information (this also appears
              if zip is run with no arguments).

       -i files
              Include only the specified files, as in:

                     zip -r foo . -i \*.c

              which will include only the files that end in .c in
              the current directory and its subdirectories. (Note
              for PKZIP users: the equivalent command is

                     pkzip -rP foo *.c

              PKZIP does not allow recursion in directories other
              than the current one.)  The  backslash  avoids  the
              shell  filename  substitution,  so  that  the  name
              matching is performed by zip at all directory  lev-
              els.

              Also possible:

                     zip -r foo  . -i@include.lst

              which  will  only  include the files in the current
              directory and its  subdirectories  that  match  the
              patterns in the file include.lst.

       -I     [Acorn  RISC  OS]  Don't  scan through Image files.
              When used, zip will not consider Image  files  (eg.
              DOS  partitions  or  Spark archives when SparkFS is
              loaded) as directories but will store them as  sin-
              gle files.

              For  example, if you have SparkFS loaded, zipping a
              Spark archive will result in a zipfile containing a
              directory  (and  its  content)  while using the 'I'
              option will result in a zipfile containing a  Spark
              archive.  Obviously  this  second case will also be
              obtained (without the 'I' option) if SparkFS  isn't
              loaded.



Info-ZIP              14 August 1999 (v2.3)                     6





ZIP(1L)                                                   ZIP(1L)


       -j     Store  just  the  name  of  a  saved file (junk the
              path),  and  do  not  store  directory  names.   By
              default,  zip will store the full path (relative to
              the current path).

       -jj    [MacOS] record Fullpath (+ Volname).  The  complete
              path  including  volume  will be stored. By default
              the relative path will be stored.

       -J     Strip any prepended data (e.g. a SFX stub) from the
              archive.

       -k     Attempt  to  convert the names and paths to conform
              to MSDOS, store only the MSDOS attribute (just  the
              user write attribute from UNIX), and mark the entry
              as made under MSDOS (even though it was  not);  for
              compatibility with PKUNZIP under MSDOS which cannot
              handle certain names such as those with two dots.

       -l     Translate the Unix end-of-line  character  LF  into
              the  MSDOS convention CR LF. This option should not
              be used on binary files.  This option can  be  used
              on  Unix  if  the  zip file is intended for PKUNZIP
              under MSDOS. If the input files already contain  CR
              LF,  this option adds an extra CR. This ensure that
              unzip -a on Unix will get back an exact copy of the
              original file, to undo the effect of zip -l.

       -ll    Translate the MSDOS end-of-line CR LF into Unix LF.
              This option should not be  used  on  binary  files.
              This option can be used on MSDOS if the zip file is
              intended for unzip under Unix.

       -L     Display the zip license.

       -m     Move the specified  files  into  the  zip  archive;
              actually, this deletes the target directories/files
              after making the specified zip archive. If a direc-
              tory  becomes empty after removal of the files, the
              directory is also removed. No  deletions  are  done
              until  zip  has  created the archive without error.
              This is useful for conserving disk  space,  but  is
              potentially  dangerous  so it is recommended to use
              it in combination  with  -T  to  test  the  archive
              before removing all input files.

       -n suffixes
              Do  not  attempt  to  compress files named with the
              given suffixes.  Such files are simply  stored  (0%
              compression)  in  the  output zip file, so that zip
              doesn't waste its time  trying  to  compress  them.
              The  suffixes  are  separated  by  either colons or
              semicolons.  For example:




Info-ZIP              14 August 1999 (v2.3)                     7





ZIP(1L)                                                   ZIP(1L)


                     zip -rn .Z:.zip:.tiff:.gif:.snd  foo foo

              will copy everything from  foo  into  foo.zip,  but
              will  store  any files that end in .Z, .zip, .tiff,
              .gif, or  .snd  without  trying  to  compress  them
              (image  and  sound  files often have their own spe-
              cialized compression  methods).   By  default,  zip
              does not compress files with extensions in the list
              .Z:.zip:.zoo:.arc:.lzh:.arj.  Such files are stored
              directly  in  the  output archive.  The environment
              variable ZIPOPT can be used to change  the  default
              options. For example under Unix with csh:

                     setenv ZIPOPT "-n .gif:.zip"

              To attempt compression on all files, use:

                     zip -n : foo

              The  maximum  compression  option  -9 also attempts
              compression on all files regardless of extension.

              On Acorn RISC OS systems the suffixes are  actually
              filetypes  (3  hex  digit  format). By default, zip
              does not compress files with filetypes in the  list
              DDC:D96:68E  (i.e.  Archives, CFS files and PackDir
              files).

       -N     [Amiga, MacOS] Save Amiga  or  MacOS  filenotes  as
              zipfile comments. They can be restored by using the
              -N option of unzip. If -c is  used  also,  you  are
              prompted  for comments only for those files that do
              not have filenotes.

       -o     Set the "last modified" time of the zip archive  to
              the  latest  (oldest)  "last  modified"  time found
              among the entries in the zip archive.  This can  be
              used without any other operations, if desired.  For
              example:

              zip -o foo

              will change the last modified time  of  foo.zip  to
              the latest time of the entries in foo.zip.


       -P password
              use  password  to encrypt zipfile entries (if any).
              THIS IS INSECURE!  Many multi-user  operating  sys-
              tems  provide  ways for any user to see the current
              command line of any other user; even on stand-alone
              systems  there  is  always  the threat of over-the-
              shoulder peeking.  Storing the  plaintext  password
              as part of a command line in an automated script is



Info-ZIP              14 August 1999 (v2.3)                     8





ZIP(1L)                                                   ZIP(1L)


              even worse.  Whenever possible, use  the  non-echo-
              ing,  interactive  prompt to enter passwords.  (And
              where  security  is  truly  important,  use  strong
              encryption  such  as Pretty Good Privacy instead of
              the relatively weak encryption provided by standard
              zipfile utilities.)

       -q     Quiet  mode;  eliminate  informational messages and
              comment prompts.  (Useful, for  example,  in  shell
              scripts and background tasks).

       -Qn    [QDOS] store information about the file in the file
              header with n defined as
              bit  0: Don't add headers for any file
              bit  1: Add headers for all files
              bit  2: Don't wait for  interactive  key  press  on
              exit

       -r     Travel  the  directory  structure  recursively; for
              example:

                     zip -r foo foo

              In this case, all the files and directories in  foo
              are saved in a zip archive named foo.zip, including
              files with  names  starting  with  ".",  since  the
              recursion  does  not use the shell's file-name sub-
              stitution mechanism.  If you wish to include only a
              specific  subset  of the files in directory foo and
              its subdirectories, use the -i  option  to  specify
              the  pattern  of  files to be included.  You should
              not use -r with the name ".*", since  that  matches
              ".."   which  will  attempt  to  zip  up the parent
              directory (probably not what was intended).

       -R     Travel the directory structure recursively starting
              at the current directory; for example:

                     zip -R foo '*.c'

              In  this  case,  all  the files matching *.c in the
              tree starting at the current directory  are  stored
              into  a  zip archive named foo.zip.  Note for PKZIP
              users: the equivalent command is

                     pkzip -rP foo *.c

       -S     [MSDOS, OS/2, WIN32 and ATARI] Include  system  and
              hidden files.
              [MacOS]  Includes finder invisible files, which are
              ignored otherwise.

       -t mmddyyyy
              Do not operate  on  files  modified  prior  to  the



Info-ZIP              14 August 1999 (v2.3)                     9





ZIP(1L)                                                   ZIP(1L)


              specified date, where mm is the month (0-12), dd is
              the day of the month (1-31), and yyyy is the  year.
              The   ISO  8601  date  format  yyyy-mm-dd  is  also
              accepted.  For example:

                     zip -rt 12071991 infamy foo

                     zip -rt 1991-12-07 infamy foo

              will add all the files in foo and  its  subdirecto-
              ries that were last modified on or after 7 December
              1991, to the zip archive infamy.zip.

       -tt mmddyyyy
              Do not operate on files modified after  or  at  the
              specified date, where mm is the month (0-12), dd is
              the day of the month (1-31), and yyyy is the  year.
              The   ISO  8601  date  format  yyyy-mm-dd  is  also
              accepted.  For example:

                     zip -rtt 11301995 infamy foo

                     zip -rtt 1995-11-30 infamy foo

              will add all the files in foo and  its  subdirecto-
              ries that were last modified before the 30 November
              1995, to the zip archive infamy.zip.

       -T     Test the integrity of the  new  zip  file.  If  the
              check  fails,  the  old  zip  file is unchanged and
              (with the -m option) no input files are removed.

       -u     Replace (update)  an  existing  entry  in  the  zip
              archive  only if it has been modified more recently
              than the version already in the zip  archive.   For
              example:

                     zip -u stuff *

              will  add  any  new files in the current directory,
              and update any files which have been modified since
              the zip archive stuff.zip was last created/modified
              (note that zip will not try to pack stuff.zip  into
              itself when you do this).

              Note that the -u option with no arguments acts like
              the -f (freshen) option.

       -v     Verbose mode or print diagnostic version info.

              Normally, when applied  to  real  operations,  this
              option  enables the display of a progress indicator
              during compression and requests verbose  diagnostic
              info about zipfile structure oddities.



Info-ZIP              14 August 1999 (v2.3)                    10





ZIP(1L)                                                   ZIP(1L)


              When -v is the only command line argument, and std-
              out is not  redirected  to  a  file,  a  diagnostic
              screen  is  printed. In addition to the help screen
              header with  program  name,  version,  and  release
              date,  some  pointers to the Info-ZIP home and dis-
              tribution sites are given. Then, it shows  informa-
              tion  about  the  target environment (compiler type
              and version, OS version, compilation date  and  the
              enabled  optional  features  used to create the zip
              executable.

       -V     [VMS] Save VMS file attributes.  zip archives  cre-
              ated  with this option will generally not be usable
              on other systems.

       -w     [VMS] Append the version number of the files to the
              name,   including   multiple   versions  of  files.
              (default: use only the most  recent  version  of  a
              specified file).

       -x files
              Explicitly exclude the specified files, as in:

                     zip -r foo foo -x \*.o

              which  will  include the contents of foo in foo.zip
              while excluding all the files that end in .o.   The
              backslash  avoids  the shell filename substitution,
              so that the name matching is performed  by  zip  at
              all directory levels.

              Also possible:

                     zip -r foo foo -x@exclude.lst

              which  will  include the contents of foo in foo.zip
              while excluding all the files that match  the  pat-
              terns in the file exclude.lst.

       -X     Do   not   save  extra  file  attributes  (Extended
              Attributes on  OS/2,  uid/gid  and  file  times  on
              Unix).

       -y     Store  symbolic  links  as such in the zip archive,
              instead  of  compressing  and  storing   the   file
              referred to by the link (UNIX only).

       -z     Prompt  for a multi-line comment for the entire zip
              archive.  The comment is ended by a line containing
              just  a  period, or an end of file condition (^D on
              UNIX, ^Z on MSDOS, OS/2, and VAX/VMS).  The comment
              can be taken from a file:

                     zip -z foo < foowhat



Info-ZIP              14 August 1999 (v2.3)                    11





ZIP(1L)                                                   ZIP(1L)


       -#     Regulate  the speed of compression using the speci-
              fied digit #, where  -0  indicates  no  compression
              (store  all  files),  -1 indicates the fastest com-
              pression method (less compression) and -9 indicates
              the  slowest  compression  method (optimal compres-
              sion, ignores the suffix list).  The  default  com-
              pression level is -6.

       -!     [WIN32]  Use  priviliges (if granted) to obtain all
              aspects of WinNT security.

       -@     Take the list of input files from  standard  input.
              Only one filename per line.

       -$     [MSDOS,  OS/2,  WIN32] Include the volume label for
              the the drive holding the first  file  to  be  com-
              pressed.   If  you  want to include only the volume
              label or to force a specific drive, use  the  drive
              name as first file name, as in:

                     zip -$ foo a: c:bar


EXAMPLES
       The simplest example:

              zip stuff *

       creates the archive stuff.zip (assuming it does not exist)
       and puts all the files in the current directory in it,  in
       compressed  form  (the .zip suffix is added automatically,
       unless that archive name given  contains  a  dot  already;
       this allows the explicit specification of other suffixes).

       Because of the way the shell does  filename  substitution,
       files starting with "." are not included; to include these
       as well:

              zip stuff .* *

       Even this will not include  any  subdirectories  from  the
       current directory.

       To zip up an entire directory, the command:

              zip -r foo foo

       creates  the archive foo.zip, containing all the files and
       directories in the directory foo that is contained  within
       the current directory.

       You may want to make a zip archive that contains the files
       in foo, without recording the directory  name,  foo.   You
       can use the -j option to leave off the paths, as in:



Info-ZIP              14 August 1999 (v2.3)                    12





ZIP(1L)                                                   ZIP(1L)


              zip -j foo foo/*

       If  you are short on disk space, you might not have enough
       room to hold both the original directory  and  the  corre-
       sponding  compressed  zip  archive.  In this case, you can
       create the archive in steps using the -m option.   If  foo
       contains the subdirectories tom, dick, and harry, you can:

              zip -rm foo foo/tom
              zip -rm foo foo/dick
              zip -rm foo foo/harry

       where the first command creates foo.zip, and the next  two
       add  to  it.   At  the completion of each zip command, the
       last created archive is deleted, making room for the  next
       zip command to function.

PATTERN MATCHING
       This  section  applies only to UNIX.  Watch this space for
       details on MSDOS and VMS operation.

       The UNIX shells (sh(1) and csh(1)) do  filename  substitu-
       tion on command arguments.  The special characters are:

       ?      match any single character

       *      match any number of characters (including none)

       []     match  any  character in the range indicated within
              the brackets (example: [a-f], [0-9]).

       When  these  characters  are  encountered  (without  being
       escaped  with  a backslash or quotes), the shell will look
       for files relative to the current path that match the pat-
       tern,  and  replace  the argument with a list of the names
       that matched.

       The zip program can do the same matching on names that are
       in  the  zip archive being modified or, in the case of the
       -x (exclude) or -i (include) options, on the list of files
       to  be operated on, by using backslashes or quotes to tell
       the shell not to do the name expansion.  In general,  when
       zip encounters a name in the list of files to do, it first
       looks for the name in the file system.  If it finds it, it
       then  adds  it to the list of files to do.  If it does not
       find it, it looks for the name in the  zip  archive  being
       modified  (if it exists), using the pattern matching char-
       acters described above, if present.  For  each  match,  it
       will  add  that name to the list of files to be processed,
       unless this name matches one given with the -x option,  or
       does not match any name given with the -i option.

       The  pattern  matching  includes the path, and so patterns
       like \*.o match names that end in ".o", no matter what the



Info-ZIP              14 August 1999 (v2.3)                    13





ZIP(1L)                                                   ZIP(1L)


       path  prefix  is.   Note  that  the backslash must precede
       every special character (i.e. ?*[]), or the  entire  argu-
       ment must be enclosed in double quotes ("").

       In  general,  use  backslash  to  make  zip do the pattern
       matching with the -f (freshen) and  -d  (delete)  options,
       and sometimes after the -x (exclude) option when used with
       an appropriate operation (add, -u, -f, or -d).

ENVIRONMENT
       ZIPOPT contains default options that  will  be  used  when
              running zip

       ZIP    [Not on RISC OS and VMS] see ZIPOPT

       Zip$Options
              [RISC OS] see ZIPOPT

       Zip$Exts
              [RISC OS] contains extensions separated by a : that
              will cause native filenames with one of the  speci-
              fied  extensions  to  be added to the zip file with
              basename and extension swapped.  zip

       ZIP_OPTS
              [VMS] see ZIPOPT

SEE ALSO
       compress(1), shar(1L), tar(1), unzip(1L), gzip(1L)

DIAGNOSTICS
       The exit status (or error  level)  approximates  the  exit
       codes defined by PKWARE and takes on the following values,
       except under VMS:

              0      normal; no errors or warnings detected.

              2      unexpected end of zip file.

              3      a generic error in the  zipfile  format  was
                     detected.   Processing  may  have  completed
                     successfully anyway;  some  broken  zipfiles
                     created by other archivers have simple work-
                     arounds.

              4      zip was unable to allocate memory for one or
                     more  buffers during program initialization.

              5      a severe error in  the  zipfile  format  was
                     detected.   Processing probably failed imme-
                     diately.

              6      entry too large to be split with zipsplit




Info-ZIP              14 August 1999 (v2.3)                    14





ZIP(1L)                                                   ZIP(1L)


              7      invalid comment format

              8      zip -T failed or out of memory

              9      the user aborted zip prematurely  with  con-
                     trol-C (or similar)

              10     zip  encountered an error while using a temp
                     file

              11     read or seek error

              12     zip has nothing to do

              13     missing or empty zip file

              14     error writing to a file

              15     zip was unable to create a file to write to

              16     bad command line parameters

              18     zip could not open a specified file to read

       VMS interprets standard Unix  (or  PC)  return  values  as
       other,  scarier-looking  things,  so zip instead maps them
       into VMS-style status codes.  The current  mapping  is  as
       follows:   1 (success) for normal exit,
        and  (0x7fff000?  +  16*normal_zip_exit_status)  for  all
       errors, where the `?' is 0 (warning) for zip value  12,  2
       (error)  for  the zip values 3, 6, 7, 9, 13, 16, 18, and 4
       (fatal error) for the remaining ones.

BUGS
       zip 2.3 is not compatible with PKUNZIP 1.10. Use  zip  1.1
       to  produce  zip  files  which can be extracted by PKUNZIP
       1.10.

       zip files produced by zip 2.3 must not be updated  by  zip
       1.1 or PKZIP 1.10, if they contain encrypted members or if
       they have been produced in a pipe  or  on  a  non-seekable
       device.  The  old versions of zip or PKZIP would create an
       archive with an incorrect format.  The  old  versions  can
       list  the  contents  of the zip file but cannot extract it
       anyway (because of the new compression algorithm).  If you
       do  not  use encryption and use regular disk files, you do
       not have to care about this problem.

       Under VMS, not all of the odd  file  formats  are  treated
       properly.  Only stream-LF format zip files are expected to
       work with  zip.   Others  can  be  converted  using  Rahul
       Dhesi's BILF program.  This version of zip handles some of
       the conversion internally.  When using Kermit to  transfer
       zip files from Vax to MSDOS, type "set file type block" on



Info-ZIP              14 August 1999 (v2.3)                    15





ZIP(1L)                                                   ZIP(1L)


       the Vax.  When transfering from MSDOS to  Vax,  type  "set
       file  type  fixed"  on  the Vax.  In both cases, type "set
       file type binary" on MSDOS.

       Under VMS, zip hangs for file specification that uses DEC-
       net syntax foo::*.*.

       On  OS/2,  zip  cannot  match  some  names,  such as those
       including an exclamation mark or a hash sign.  This  is  a
       bug  in  OS/2  itself:  the 32-bit DosFindFirst/Next don't
       find such names.  Other programs such as GNU tar are  also
       affected by this bug.

       Under OS/2, the amount of Extended Attributes displayed by
       DIR is (for compatibility)  the  amount  returned  by  the
       16-bit  version  of DosQueryPathInfo(). Otherwise OS/2 1.3
       and 2.0 would report different  EA  sizes  when  DIRing  a
       file.   However,  the  structure  layout  returned  by the
       32-bit DosQueryPathInfo() is  a  bit  different,  it  uses
       extra padding bytes and link pointers (it's a linked list)
       to have all fields on 4-byte boundaries for portability to
       future RISC OS/2 versions. Therefore the value reported by
       zip (which uses this 32-bit-mode size) differs  from  that
       reported  by DIR.  zip stores the 32-bit format for porta-
       bility, even the 16-bit MS-C-compiled version  running  on
       OS/2 1.3, so even this one shows the 32-bit-mode size.

AUTHORS
       Copyright  (C)  1990-1997  Mark  Adler,  Richard B. Wales,
       Jean-loup Gailly, Onno van der  Linden,  Kai  Uwe  Rommel,
       Igor Mandrichenko, John Bush and Paul Kienitz.  Permission
       is granted to any individual or institution to use,  copy,
       or redistribute this software so long as all of the origi-
       nal files are included, that it is not  sold  for  profit,
       and that this copyright notice is retained.

       LIKE  ANYTHING  ELSE  THAT'S  FREE, ZIP AND ITS ASSOCIATED
       UTILITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY  OF
       ANY  KIND,  EITHER  EXPRESSED OR IMPLIED. IN NO EVENT WILL
       THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES  RESULTING
       FROM THE USE OF THIS SOFTWARE.

       Please   send  bug  reports  and  comments  by  email  to:
       zip-bugs@lists.wku.edu.  For bug reports,  please  include
       the  version of zip (see zip-h ), the make options used to
       compile it see zip-v ), the machine and  operating  system
       in use, and as much additional information as possible.

ACKNOWLEDGEMENTS
       Thanks  to  R.  P. Byrne for his Shrink.Pas program, which
       inspired this project, and from which the shrink algorithm
       was  stolen; to Phil Katz for placing in the public domain
       the zip file format, compression format, and .ZIP filename
       extension,  and  for  accepting  minor changes to the file



Info-ZIP              14 August 1999 (v2.3)                    16





ZIP(1L)                                                   ZIP(1L)


       format; to Steve Burg for clarifications  on  the  deflate
       format;  to  Haruhiko Okumura and Leonid Broukhis for pro-
       viding some useful ideas for the compression algorithm; to
       Keith  Petersen, Rich Wales, Hunter Goatley and Mark Adler
       for providing a mailing list and ftp site for the Info-ZIP
       group  to use; and most importantly, to the Info-ZIP group
       itself (listed in  the  file  infozip.who)  without  whose
       tireless  testing  and  bug-fixing  efforts a portable zip
       would not have been possible.   Finally  we  should  thank
       (blame)  the  first  Info-ZIP moderator, David Kirschbaum,
       for getting us into this mess in  the  first  place.   The
       manual page was rewritten for UNIX by R. P. C. Rodgers.









UNZIP(1L)                                               UNZIP(1L)

NAME
       unzip  -  list, test and extract compressed files in a ZIP
       archive

SYNOPSIS
       unzip    [-Z]    [-cflptuvz[abjnoqsCLMVX$]]     file[.zip]
       [file(s) ...]  [-x xfile(s) ...] [-d exdir]

DESCRIPTION
       unzip  will  list,  test,  or  extract  files  from  a ZIP
       archive, commonly found on MS-DOS  systems.   The  default
       behavior  (with no options) is to extract into the current
       directory (and subdirectories below it) all files from the
       specified ZIP archive.  A companion program, zip(1L), cre-
       ates ZIP  archives;  both  programs  are  compatible  with
       archives created by PKWARE's PKZIP and PKUNZIP for MS-DOS,
       but in many cases the program options or default behaviors
       differ.

ARGUMENTS
       file[.zip]
              Path of the ZIP archive(s).  If the file specifica-
              tion is a wildcard, each matching file is processed
              in  an order determined by the operating system (or
              file system).  Only the filename can be a wildcard;
              the  path  itself cannot.  Wildcard expressions are
              similar to Unix egrep(1) (regular) expressions  and
              may contain:

              *      matches a sequence of 0 or more characters

              ?      matches exactly 1 character

              [...]  matches  any  single  character found inside
                     the brackets;  ranges  are  specified  by  a
                     beginning character, a hyphen, and an ending
                     character.  If an  exclamation  point  or  a
                     caret (`!' or `^') follows the left bracket,
                     then the  range  of  characters  within  the
                     brackets  is complemented (that is, anything
                     except the characters inside the brackets is
                     considered a match).

              (Be  sure  to quote any character that might other-
              wise be interpreted or modified  by  the  operating
              system,  particularly  under  Unix and VMS.)  If no
              matches are found, the specification is assumed  to
              be  a literal filename; and if that also fails, the
              suffix .zip is appended.  Note that self-extracting
              ZIP  files  are  supported,  as  with any other ZIP
              archive; just specify  the  .exe  suffix  (if  any)
              explicitly.

Info-ZIP             28 November 1998 (v5.4)                    1

UNZIP(1L)                                               UNZIP(1L)

       [file(s)]
              An  optional  list  of  archive  members to be pro-
              cessed, separated by spaces.   (VMS  versions  com-
              piled  with  VMSCLI defined must delimit files with
              commas instead.  See -v in OPTIONS below.)  Regular
              expressions (wildcards) may be used to match multi-
              ple members; see above.  Again, be  sure  to  quote
              expressions  that  would  otherwise  be expanded or
              modified by the operating system.

       [-x xfile(s)]
              An optional list of archive members to be  excluded
              from  processing.   Since wildcard characters match
              directory separators (`/'), this option may be used
              to  exclude  any  files that are in subdirectories.
              For example, ``unzip  foo  *.[ch]  -x  */*''  would
              extract  all  C source files in the main directory,
              but none in any  subdirectories.   Without  the  -x
              option,  all  C  source  files  in  all directories
              within the zipfile would be extracted.

       [-d exdir]
              An optional directory to which  to  extract  files.
              By default, all files and subdirectories are recre-
              ated in the current directory; the -d option allows
              extraction in an arbitrary directory (always assum-
              ing one has permission to write to the  directory).
              This  option need not appear at the end of the com-
              mand line; it is also accepted before  the  zipfile
              specification  (with  the  normal options), immedi-
              ately after the zipfile specification,  or  between
              the  file(s)  and  the  -x  option.  The option and
              directory may be  concatenated  without  any  white
              space  between  them,  but note that this may cause
              normal shell behavior to be suppressed.  In partic-
              ular, ``-d ~'' (tilde) is expanded by Unix C shells
              into the name of the  user's  home  directory,  but
              ``-d~''  is treated as a literal subdirectory ``~''
              of the current directory.

OPTIONS
       Note that,  in  order  to  support  obsolescent  hardware,
       unzip's  usage  screen  is  limited  to 22 or 23 lines and
       should therefore be considered  only  a  reminder  of  the
       basic  unzip  syntax rather than an exhaustive list of all
       possible flags.  The exhaustive list follows:

       -Z     zipinfo(1L) mode.  If the first option on the  com-
              mand line is -Z, the remaining options are taken to
              be zipinfo(1L) options.  See the appropriate manual
              page for a description of these options.

       -A     [OS/2,  Unix DLL] print extended help for the DLL's
              programming interface (API).

Info-ZIP             28 November 1998 (v5.4)                    2

UNZIP(1L)                                               UNZIP(1L)

       -c     extract files  to  stdout/screen  (``CRT'').   This
              option  is similar to the -p option except that the
              name of each file is printed as  it  is  extracted,
              the  -a option is allowed, and ASCII-EBCDIC conver-
              sion is  automatically  performed  if  appropriate.
              This  option  is  not  listed  in  the  unzip usage
              screen.

       -f     freshen existing files, i.e.,  extract  only  those
              files that already exist on disk and that are newer
              than the disk copies.   By  default  unzip  queries
              before  overwriting,  but the -o option may be used
              to suppress the  queries.   Note  that  under  many
              operating  systems,  the  TZ (timezone) environment
              variable must be set correctly in order for -f  and
              -u  to  work  properly  (under Unix the variable is
              usually set automatically).  The reasons  for  this
              are somewhat subtle but have to do with the differ-
              ences between DOS-format file times  (always  local
              time) and Unix-format times (always in GMT/UTC) and
              the necessity to compare the  two.   A  typical  TZ
              value  is  ``PST8PDT''  (US Pacific time with auto-
              matic  adjustment  for  Daylight  Savings  Time  or
              ``summer time'').

       -l     list  archive  files  (short  format).   The names,
              uncompressed file sizes and modification dates  and
              times  of  the  specified  files are printed, along
              with totals for all files specified.  If UnZip  was
              compiled  with  OS2_EAS defined, the -l option also
              lists columns for the sizes of stored OS/2 extended
              attributes  (EAs)  and  OS/2  access  control lists
              (ACLs).  In addition, the zipfile comment and indi-
              vidual  file comments (if any) are displayed.  If a
              file was archived from a  single-case  file  system
              (for  example,  the old MS-DOS FAT file system) and
              the -L option was given, the filename is  converted
              to lowercase and is prefixed with a caret (^).

       -p     extract  files  to  pipe (stdout).  Nothing but the
              file data is sent to  stdout,  and  the  files  are
              always extracted in binary format, just as they are
              stored (no conversions).

       -t     test archive  files.   This  option  extracts  each
              specified  file  in  memory  and  compares  the CRC
              (cyclic redundancy check, an enhanced checksum)  of
              the  expanded  file with the original file's stored
              CRC value.

       -T     [most OSes] set the timestamp on the archive(s)  to
              that  of  the newest file in each one.  This corre-
              sponds to zip's -go option except that  it  can  be
              used   on   wildcard  zipfiles  (e.g.,  ``unzip  -T

Info-ZIP             28 November 1998 (v5.4)                    3

UNZIP(1L)                                               UNZIP(1L)

              \*.zip'') and is much faster.

       -u     update  existing  files  and  create  new  ones  if
              needed.   This option performs the same function as
              the -f option, extracting (with query)  files  that
              are  newer  than  those with the same name on disk,
              and in addition it extracts those files that do not
              already  exist  on disk.  See -f above for informa-
              tion on setting the timezone properly.

       -v     be verbose or print diagnostic version info.   This
              option  has  evolved  and  now  behaves  as both an
              option and a modifier.  As an  option  it  has  two
              purposes:   when  a  zipfile  is  specified with no
              other options, -v lists  archive  files  verbosely,
              adding to the basic -l info the compression method,
              compressed size, compression ratio and 32-bit  CRC.
              When no zipfile is specified (that is, the complete
              command  is  simply  ``unzip  -v''),  a  diagnostic
              screen  is  printed.   In  addition  to  the normal
              header with release date and version,  unzip  lists
              the home Info-ZIP ftp site and where to find a list
              of other ftp and non-ftp sites; the target  operat-
              ing  system  for  which it was compiled, as well as
              (possibly) the hardware on which it  was  compiled,
              the  compiler and version used, and the compilation
              date; any special compilation  options  that  might
              affect the program's operation (see also DECRYPTION
              below); and any options stored in environment vari-
              ables  that  might  do  the  same  (see ENVIRONMENT
              OPTIONS below).  As a modifier it works in conjunc-
              tion  with other options (e.g., -t) to produce more
              verbose or debugging output; this is not yet  fully
              implemented but will be in future releases.

       -z     display only the archive comment.

MODIFIERS
       -a     convert  text  files.   Ordinarily  all  files  are
              extracted exactly as they are stored (as ``binary''
              files).   The  -a option causes files identified by
              zip as text files (those with the `t' label in zip-
              info listings, rather than `b') to be automatically
              extracted as such, converting line endings, end-of-
              file  characters  and  the  character set itself as
              necessary.  (For example, Unix files use line feeds
              (LFs) for end-of-line (EOL) and have no end-of-file
              (EOF)  marker;  Macintoshes  use  carriage  returns
              (CRs)  for  EOLs; and most PC operating systems use
              CR+LF for EOLs and control-Z for EOF.  In addition,
              IBM mainframes and the Michigan Terminal System use
              EBCDIC rather than the more common ASCII  character
              set,  and  NT  supports  Unicode.)  Note that zip's
              identification  of  text  files  is  by  no   means

Info-ZIP             28 November 1998 (v5.4)                    4

UNZIP(1L)                                               UNZIP(1L)

              perfect; some ``text'' files may actually be binary
              and vice versa.  unzip therefore prints  ``[text]''
              or  ``[binary]'' as a visual check for each file it
              extracts when using the -a option.  The -aa  option
              forces  all  files to be extracted as text, regard-
              less of the supposed file type.

       -b     [non-VMS] treat all files as binary (no  text  con-
              versions).  This is a shortcut for ---a.

       -b     [VMS]  auto-convert  binary files (see -a above) to
              fixed-length, 512-byte record format.  Doubling the
              option  (-bb)  forces  all files to be extracted in
              this format.

       -B     [Unix only, and only if  compiled  with  UNIXBACKUP
              defined]  save  a  backup  copy of each overwritten
              file with a tilde appended (e.g., the old  copy  of
              ``foo''  is  renamed to ``foo~'').  This is similar
              to the default behavior of emacs(1) in  many  loca-
              tions.

       -C     match  filenames  case-insensitively.  unzip's phi-
              losophy is ``you get what you ask  for''  (this  is
              also responsible for the -L/-U change; see the rel-
              evant options below).  Because  some  file  systems
              are  fully  case-sensitive (notably those under the
              Unix  operating  system)  and  because   both   ZIP
              archives and unzip itself are portable across plat-
              forms, unzip's default behavior is  to  match  both
              wildcard  and  literal  filenames case-sensitively.
              That is, specifying  ``makefile''  on  the  command
              line  will  only match ``makefile'' in the archive,
              not ``Makefile'' or ``MAKEFILE'' (and similarly for
              wildcard specifications).  Since this does not cor-
              respond to  the  behavior  of  many  other  operat-
              ing/file  systems  (for  example,  OS/2 HPFS, which
              preserves mixed case but is not sensitive  to  it),
              the  -C  option  may  be used to force all filename
              matches to be  case-insensitive.   In  the  example
              above,  all  three  files  would then match ``make-
              file'' (or ``make*'', or similar).  The  -C  option
              affects  files in both the normal file list and the
              excluded-file list (xlist).

       -E     [MacOS only] display contents of MacOS extra  field
              during restore operation.

       -F     [Acorn  only]  suppress  removal  of  NFS  filetype
              extension from stored filenames.

       -F     [Unix   only,   and   only   if    compiled    with
              ACORN_FTYPE_NFS  defined] translate filetype infor-
              mation from ACORN RISC OS extra field blocks into a

Info-ZIP             28 November 1998 (v5.4)                    5

UNZIP(1L)                                               UNZIP(1L)

              NFS  filetype  extension and append it to the names
              of the extracted files.  (When the stored  filename
              appears  to  already  have an appended NFS filetype
              extension, it is replaced  by  the  info  from  the
              extra field.)

       -i     [MacOS only] ignore filenames stored in MacOS extra
              fields.  Instead,  the  most  compatible   filename
              stored in the generic part of the entry's header is
              used.

       -j     junk paths.  The archive's directory  structure  is
              not  recreated;  all  files  are  deposited  in the
              extraction directory (by default, the current one).

       -J     [BeOS  only] junk file attributes.  The file's BeOS
              file attributes are not restored, just  the  file's
              data.

       -J     [MacOS only] ignore MacOS extra fields.  All Macin-
              tosh  specific  info  is  skipped.  Data-fork   and
              resource-fork are restored as separate files.

       -L     convert to lowercase any filename originating on an
              uppercase-only operating  system  or  file  system.
              (This  was  unzip's  default  behavior  in releases
              prior to 5.11; the new default behavior is  identi-
              cal  to  the old behavior with the -U option, which
              is now obsolete and will be  removed  in  a  future
              release.)    Depending   on   the  archiver,  files
              archived under single-case file systems  (VMS,  old
              MS-DOS  FAT,  etc.)  may be stored as all-uppercase
              names;  this  can  be  ugly  or  inconvenient  when
              extracting to a case-preserving file system such as
              OS/2 HPFS or a case-sensitive  one  such  as  under
              Unix.   By  default  unzip  lists and extracts such
              filenames  exactly  as  they're  stored  (excepting
              truncation,  conversion  of unsupported characters,
              etc.); this option causes the names  of  all  files
              from  certain systems to be converted to lowercase.

       -M     pipe all output through an internal  pager  similar
              to  the  Unixmore(1)  command.   At  the  end  of a
              screenful  of   output,   unzip   pauses   with   a
              ``--More--''  prompt;  the  next  screenful  may be
              viewed by pressing the Enter (Return)  key  or  the
              space bar.  unzip can be terminated by pressing the
              ``q'' key and, on some  systems,  the  Enter/Return
              key.   Unlike  Unix  more(1),  there is no forward-
              searching  or  editing  capability.   Also,   unzip
              doesn't  notice  if  long lines wrap at the edge of
              the screen, effectively resulting in  the  printing
              of  two  or more lines and the likelihood that some
              text will scroll off the top of the  screen  before

Info-ZIP             28 November 1998 (v5.4)                    6

UNZIP(1L)                                               UNZIP(1L)

              being viewed.  On some systems the number of avail-
              able lines on the screen is not detected, in  which
              case unzip assumes the height is 24 lines.

       -n     never  overwrite existing files.  If a file already
              exists, skip the extraction of  that  file  without
              prompting.    By   default   unzip  queries  before
              extracting any file that already exists;  the  user
              may  choose  to  overwrite  only  the current file,
              overwrite all files, skip extraction of the current
              file,  skip  extraction  of  all existing files, or
              rename the current file.

       -N     [Amiga] extract file comments as  Amiga  filenotes.
              File  comments  are  created  with the -c option of
              zip(1L), or with the -N option of the Amiga port of
              zip(1L), which stores filenotes as comments.

       -o     overwrite  existing  files without prompting.  This
              is a dangerous option, so use it with care.  (It is
              often used with -f, however, and is the only way to
              overwrite directory EAs under OS/2.)

       -P password
              use password to decrypt encrypted  zipfile  entries
              (if any).  THIS IS INSECURE!  Many multi-user oper-
              ating systems provide ways for any user to see  the
              current  command  line  of  any other user; even on
              stand-alone systems there is always the  threat  of
              over-the-shoulder  peeking.   Storing the plaintext
              password as part of a command line in an  automated
              script  is  even worse.  Whenever possible, use the
              non-echoing, interactive prompt to enter passwords.
              (And  where security is truly important, use strong
              encryption such as Pretty Good Privacy  instead  of
              the relatively weak encryption provided by standard
              zipfile utilities.)

       -q     perform operations quietly (-qq  =  even  quieter).
              Ordinarily unzip prints the names of the files it's
              extracting or testing, the extraction methods,  any
              file  or zipfile comments that may be stored in the
              archive, and possibly a summary when finished  with
              each  archive.   The  -q[q]  options  suppress  the
              printing of some or all of these messages.

       -s     [OS/2, NT, MS-DOS] convert spaces in  filenames  to
              underscores.   Since all PC operating systems allow
              spaces in  filenames,  unzip  by  default  extracts
              filenames     with     spaces     intact     (e.g.,
              ``EA DATA. SF'').  This can  be  awkward,  however,
              since MS-DOS in particular does not gracefully sup-
              port spaces in filenames.  Conversion of spaces  to

Info-ZIP             28 November 1998 (v5.4)                    7

UNZIP(1L)                                               UNZIP(1L)

              underscores  can  eliminate the awkwardness in some
              cases.

       -U     (obsolete; to be removed in a future release) leave
              filenames  uppercase  if created under MS-DOS, VMS,
              etc.  See -L above.

       -V     retain (VMS) file version numbers.  VMS  files  can
              be  stored  with  a  version  number, in the format
              file.ext;##.  By default the ``;##''  version  num-
              bers  are  stripped, but this option allows them to
              be retained.  (On file systems that limit filenames
              to  particularly short lengths, the version numbers
              may be truncated or  stripped  regardless  of  this
              option.)

       -X     [VMS, Unix, OS/2, NT] restore owner/protection info
              (UICs) under VMS, or user and group info  (UID/GID)
              under  Unix,  or  access control lists (ACLs) under
              certain  network-enabled  versions  of  OS/2  (Warp
              Server  with  IBM  LAN Server/Requester 3.0 to 5.0;
              Warp Connect with IBM Peer 1.0), or  security  ACLs
              under  Windows NT.  In most cases this will require
              special system privileges, and doubling the  option
              (-XX)  under  NT  instructs unzip to use privileges
              for extraction; but under Unix, for example, a user
              who  belongs  to  several  groups can restore files
              owned by any of those groups, as long as  the  user
              IDs  match his or her own.  Note that ordinary file
              attributes are always restored--this option applies
              only to optional, extra ownership info available on
              some operating systems.  [NT's access control lists
              do  not  appear  to  be  especially compatible with
              OS/2's, so no attempt  is  made  at  cross-platform
              portability  of access privileges.  It is not clear
              under what conditions this  would  ever  be  useful
              anyway.]

       -$     [MS-DOS,  OS/2, NT] restore the volume label if the
              extraction medium is removable (e.g., a  diskette).
              Doubling  the option (-$$) allows fixed media (hard
              disks) to be labelled as well.  By default,  volume
              labels are ignored.

ENVIRONMENT OPTIONS
       unzip's  default  behavior  may  be  modified  via options
       placed in an environment variable.  This can be done  with
       any  option,  but  it is probably most useful with the -a,
       -L, -C, -q, -o, or -n modifiers:  make unzip  auto-convert
       text  files  by  default,  make  it convert filenames from
       uppercase systems to lowercase, make it match names  case-
       insensitively,  make  it  quieter, or make it always over-
       write or never overwrite files as it extracts  them.   For
       example,  to  make  unzip act as quietly as possible, only

Info-ZIP             28 November 1998 (v5.4)                    8

UNZIP(1L)                                               UNZIP(1L)

       reporting errors, one would use one of the following  com-
       mands:

           UNZIP=-qq; export UNZIP    Unix Bourne shell
           setenv UNZIP -qq           Unix C shell
           set UNZIP=-qq              OS/2 or MS-DOS
           define UNZIP_OPTS "-qq"    VMS (quotes for lowercase)

       Environment  options are, in effect, considered to be just
       like any other command-line options, except that they  are
       effectively  the  first  options  on the command line.  To
       override an environment option, one may  use  the  ``minus
       operator'' to remove it.  For instance, to override one of
       the quiet-flags in the example above, use the command

           unzip --q[other options] zipfile

       The first hyphen is the normal switch character,  and  the
       second  is a minus sign, acting on the q option.  Thus the
       effect here is to cancel one  quantum  of  quietness.   To
       cancel  both  quiet  flags,  two  (or more) minuses may be
       used:

           unzip -t--q zipfile
           unzip ---qt zipfile

       (the two are equivalent).  This may seem awkward  or  con-
       fusing,  but  it is reasonably intuitive:  just ignore the
       first hyphen and go from there.   It  is  also  consistent
       with the behavior of Unix nice(1).

       As  suggested  by the examples above, the default variable
       names are UNZIP_OPTS for VMS (where  the  symbol  used  to
       install unzip as a foreign command would otherwise be con-
       fused with the environment variable), and  UNZIP  for  all
       other  operating systems.  For compatibility with zip(1L),
       UNZIPOPT is also accepted (don't ask).  If both UNZIP  and
       UNZIPOPT  are  defined,  however,  UNZIP takes precedence.
       unzip's diagnostic option (-v with no zipfile name) can be
       used  to  check  the values of all four possible unzip and
       zipinfo environment variables.

       The timezone variable (TZ) should be set according to  the
       local  timezone in order for the -f and -u to operate cor-
       rectly.  See the description  of  -f  above  for  details.
       This  variable  may  also be necessary in order for times-
       tamps on extracted files to be set correctly.  Under  Win-
       dows  95/NT unzip should know the correct timezone even if
       TZ is unset, assuming the timezone is correctly set in the
       Control Panel.

DECRYPTION
       Encrypted  archives  are fully supported by Info-ZIP soft-
       ware, but due to United States  export  restrictions,  the

Info-ZIP             28 November 1998 (v5.4)                    9

UNZIP(1L)                                               UNZIP(1L)

       encryption  and  decryption  sources are not packaged with
       the regular unzip and zip distributions.  Since the  crypt
       sources  were  written  by  Europeans,  however,  they are
       freely available at sites throughout the  world;  see  the
       file  ``WHERE'' in any Info-ZIP source or binary distribu-
       tion for locations both inside and outside the US.

       Because of the separate  distribution,  not  all  compiled
       versions  of unzip support decryption.  To check a version
       for crypt support, either attempt to test  or  extract  an
       encrypted archive, or else check unzip's diagnostic screen
       (see the -v option above) for ``[decryption]'' as  one  of
       the special compilation options.

       As  noted  above,  the  -P  option may be used to supply a
       password on the command line, but at a cost  in  security.
       The  preferred decryption method is simply to extract nor-
       mally; if a zipfile member is encrypted, unzip will prompt
       for  the  password  without  echoing what is typed.  unzip
       continues to use the same password as long as  it  appears
       to  be  valid,  by  testing a 12-byte header on each file.
       The correct password will always  check  out  against  the
       header,  but  there is a 1-in-256 chance that an incorrect
       password will as well.  (This is a security feature of the
       PKWARE   zipfile  format;  it  helps  prevent  brute-force
       attacks that might otherwise gain a large speed  advantage
       by  testing  only the header.)  In the case that an incor-
       rect password is given but it passes the header test  any-
       way,  either  an  incorrect  CRC will be generated for the
       extracted data or else unzip will fail during the  extrac-
       tion  because  the ``decrypted'' bytes do not constitute a
       valid compressed data stream.

       If the first password fails the header check on some file,
       unzip  will  prompt  for another password, and so on until
       all files are extracted.  If  a  password  is  not  known,
       entering  a null password (that is, just a carriage return
       or ``Enter'') is taken as a signal  to  skip  all  further
       prompting.   Only unencrypted files in the archive(s) will
       thereafter be extracted.  (In fact, that's not quite true;
       older  versions  of  zip(1L) and zipcloak(1L) allowed null
       passwords, so unzip checks each encrypted file to  see  if
       the null password works.  This may result in ``false posi-
       tives'' and extraction errors, as noted above.)

       Archives encrypted  with  8-bit  passwords  (for  example,
       passwords  with  accented  European characters) may not be
       portable across  systems  and/or  other  archivers.   This
       problem  stems  from  the use of multiple encoding methods
       for such characters, including Latin-1  (ISO  8859-1)  and
       OEM  code  page  850.   DOS  PKZIP 2.04g uses the OEM code
       page; Windows PKZIP 2.50 uses Latin-1  (and  is  therefore
       incompatible  with  DOS PKZIP); Info-ZIP uses the OEM code
       page on DOS, OS/2 and Win3.x ports but Latin-1  everywhere

Info-ZIP             28 November 1998 (v5.4)                   10

UNZIP(1L)                                               UNZIP(1L)

       else; and Nico Mak's WinZip 6.x does not allow 8-bit pass-
       words at all.  UnZip 5.3 attempts to use the default char-
       acter set first (e.g., Latin-1), followed by the alternate
       one (e.g., OEM code page) to test  passwords.   On  EBCDIC
       systems,  if  both  of these fail, EBCDIC encoding will be
       tested as a  last  resort.   (Since  there  are  no  known
       archivers  that  encrypt  using EBCDIC encoding, EBCDIC is
       not tested on non-EBCDIC systems.)  ISO  character  encod-
       ings other than Latin-1 are not supported.

EXAMPLES
       To  use  unzip  to extract all members of the archive let-
       ters.zip into the  current  directory  and  subdirectories
       below it, creating any subdirectories as necessary:

           unzip letters

       To  extract  all  members  of letters.zip into the current
       directory only:

           unzip -j letters

       To test letters.zip, printing only a summary message indi-
       cating whether the archive is OK or not:

           unzip -tq letters

       To  test  all  zipfiles in the current directory, printing
       only the summaries:

           unzip -tq \*.zip

       (The backslash before the asterisk is only required if the
       shell  expands  wildcards, as in Unix; double quotes could
       have  been  used  instead,  as  in  the  source   examples
       below.)  To extract to standard output all members of let-
       ters.zip whose names end in .tex, auto-converting  to  the
       local  end-of-line  convention  and piping the output into
       more(1):

           unzip -ca letters \*.tex | more

       To extract the binary file paper1.dvi to  standard  output
       and pipe it to a printing program:

           unzip -p articles paper1.dvi | dvips

       To  extract all FORTRAN and C source files--*.f, *.c, *.h,
       and Makefile--into the /tmp directory:

           unzip source.zip "*.[fch]" Makefile -d /tmp

       (the double quotes are necessary only in Unix and only  if
       globbing  is  turned  on).   To  extract all FORTRAN and C

Info-ZIP             28 November 1998 (v5.4)                   11

UNZIP(1L)                                               UNZIP(1L)

       source files, regardless of case (e.g., both *.c and  *.C,
       and any makefile, Makefile, MAKEFILE or similar):

           unzip -C source.zip "*.[fch]" makefile -d /tmp

       To extract any such files but convert any uppercase MS-DOS
       or VMS names to lowercase and convert the line-endings  of
       all of the files to the local standard (without respect to
       any files that might be marked ``binary''):

           unzip -aaCL source.zip "*.[fch]" makefile -d /tmp

       To extract only newer versions of the files already in the
       current  directory, without querying (NOTE:  be careful of
       unzipping  in  one   timezone   a   zipfile   created   in
       another--ZIP  archives other than those created by Zip 2.1
       or later contain no timezone information, and a  ``newer''
       file from an eastern timezone may, in fact, be older):

           unzip -fo sources

       To extract newer versions of the files already in the cur-
       rent directory and to create any files not  already  there
       (same caveat as previous example):

           unzip -uo sources

       To  display  a  diagnostic  screen showing which unzip and
       zipinfo  options  are  stored  in  environment  variables,
       whether  decryption  support was compiled in, the compiler
       with which unzip was compiled, etc.:

           unzip -v

       In the last five examples, assume that UNZIP or UNZIP_OPTS
       is set to -q.  To do a singly quiet listing:

           unzip -l file.zip

       To do a doubly quiet listing:

           unzip -ql file.zip

       (Note  that  the ``.zip'' is generally not necessary.)  To
       do a standard listing:

           unzip --ql file.zip
       or
           unzip -l-q file.zip
       or
           unzip -l--q file.zip       (extra minuses don't hurt)

TIPS
       The current maintainer, being a lazy sort, finds  it  very

Info-ZIP             28 November 1998 (v5.4)                   12

UNZIP(1L)                                               UNZIP(1L)

       useful  to define a pair of aliases:  tt for ``unzip -tq''
       and ii for ``unzip -Z'' (or ``zipinfo'').   One  may  then
       simply  type  ``tt zipfile'' to test an archive, something
       that is worth making a habit of doing.   With  luck  unzip
       will  report  ``No  errors  detected in compressed data of
       zipfile.zip,'' after which  one  may  breathe  a  sigh  of
       relief.

       The maintainer also finds it useful to set the UNZIP envi-
       ronment variable to ``-aL'' and is tempted to  add  ``-C''
       as well.  His ZIPINFO variable is set to ``-z''.

DIAGNOSTICS
       The  exit  status  (or  error level) approximates the exit
       codes defined by PKWARE and takes on the following values,
       except under VMS:

              0      normal; no errors or warnings detected.

              1      one or more warning errors were encountered,
                     but processing completed  successfully  any-
                     way.   This  includes  zipfiles where one or
                     more files was skipped  due  to  unsupported
                     compression  method  or  encryption  with an
                     unknown password.

              2      a generic error in the  zipfile  format  was
                     detected.   Processing  may  have  completed
                     successfully anyway;  some  broken  zipfiles
                     created by other archivers have simple work-
                     arounds.

              3      a severe error in  the  zipfile  format  was
                     detected.   Processing probably failed imme-
                     diately.

              4      unzip was unable to allocate memory for  one
                     or  more  buffers during program initializa-
                     tion.

              5      unzip  was  unable  to  allocate  memory  or
                     unable  to  obtain a tty to read the decryp-
                     tion password(s).

              6      unzip was unable to allocate  memory  during
                     decompression to disk.

              7      unzip  was  unable to allocate memory during
                     in-memory decompression.

              8      [currently not used]

              9      the specified zipfiles were not found.

Info-ZIP             28 November 1998 (v5.4)                   13

UNZIP(1L)                                               UNZIP(1L)

              10     invalid options were specified on  the  com-
                     mand line.

              11     no matching files were found.

              50     the disk is (or was) full during extraction.

              51     the end of the ZIP archive  was  encountered
                     prematurely.

              80     the user aborted unzip prematurely with con-
                     trol-C (or similar)

              81     testing or extraction of one or  more  files
                     failed  due to unsupported compression meth-
                     ods or unsupported decryption.

              82     no files were found due  to  bad  decryption
                     password(s).   (If even one file is success-
                     fully processed, however, the exit status is
                     1.)

       VMS  interprets  standard  Unix  (or  PC) return values as
       other, scarier-looking things, so unzip instead maps  them
       into  VMS-style  status  codes.  The current mapping is as
       follows:   1 (success) for  normal  exit,  0x7fff0001  for
       warning     errors,     and    (0x7fff000?    +    16*nor-
       mal_unzip_exit_status) for all other errors, where the `?'
       is  2  (error)  for  unzip values 2, 9-11 and 80-82, and 4
       (fatal error) for the remaining ones (3-8,  50,  51).   In
       addition,  there  is  a  compilation option to expand upon
       this behavior:  defining RETURN_CODES results in a  human-
       readable explanation of what the error status means.

BUGS
       Multi-part  archives are not yet supported, except in con-
       junction  with  zip.   (All  parts  must  be  concatenated
       together  in  order, and then ``zip -F'' must be performed
       on the concatenated archive in order to ``fix'' it.)  This
       will definitely be corrected in the next major release.

       Archives  read  from standard input are not yet supported,
       except with funzip (and then only the first member of  the
       archive can be extracted).

       Archives  encrypted  with 8-bit passwords (e.g., passwords
       with accented European characters)  may  not  be  portable
       across systems and/or other archivers.  See the discussion
       in DECRYPTION above.

       unzip's -M (``more'') option is overly simplistic  in  its
       handling  of  screen  output;  as noted above, it fails to
       detect the wrapping of long lines and  may  thereby  cause
       lines  at  the top of the screen to be scrolled off before

Info-ZIP             28 November 1998 (v5.4)                   14

UNZIP(1L)                                               UNZIP(1L)

       being read.  unzip should detect and treat each occurrence
       of   line-wrap  as  one  additional  line  printed.   This
       requires knowledge of the screen's width as  well  as  its
       height.   In addition, unzip should detect the true screen
       geometry on all systems.

       Dates, times and permissions of stored directories are not
       restored except under Unix.

       [MS-DOS]  When extracting or testing files from an archive
       on a defective floppy diskette, if the ``Fail'' option  is
       chosen  from  DOS's ``Abort, Retry, Fail?'' message, older
       versions of unzip may hang the system, requiring a reboot.
       This  problem  appears to be fixed, but control-C (or con-
       trol-Break) can still be used to terminate unzip.

       Under DEC Ultrix, unzip would sometimes fail on long  zip-
       files (bad CRC, not always reproducible).  This was appar-
       ently due either to a hardware bug (cache  memory)  or  an
       operating  system bug (improper handling of page faults?).
       Since Ultrix has been abandoned in favor of  Digital  Unix
       (OSF/1), this may not be an issue anymore.

       [Unix]  Unix  special  files  such  as FIFO buffers (named
       pipes),  block  devices  and  character  devices  are  not
       restored  even if they are somehow represented in the zip-
       file, nor are hard-linked files relinked.   Basically  the
       only  file  types  restored  by  unzip  are regular files,
       directories and symbolic (soft) links.

       [OS/2] Extended attributes for  existing  directories  are
       only  updated  if  the  -o  (``overwrite  all'') option is
       given.  This is a  limitation  of  the  operating  system;
       because  directories  only have a creation time associated
       with them, unzip has  no  way  to  determine  whether  the
       stored  attributes  are newer or older than those on disk.
       In practice this may mean a two-pass approach is required:
       first  unpack the archive normally (with or without fresh-
       ening/updating existing files), then  overwrite  just  the
       directory entries (e.g., ``unzip -o foo */'').

       [VMS]  When  extracting  to  another  directory,  only the
       [.foo] syntax is accepted for the -d  option;  the  simple
       Unix foo syntax is silently ignored (as is the less common
       VMS foo.dir syntax).

       [VMS]  When  the  file  being  extracted  already  exists,
       unzip's  query only allows skipping, overwriting or renam-
       ing; there should additionally be a choice for creating  a
       new  version  of  the  file.   In  fact, the ``overwrite''
       choice does create a new version; the old version  is  not
       overwritten or deleted.

Info-ZIP             28 November 1998 (v5.4)                   15

UNZIP(1L)                                               UNZIP(1L)

SEE ALSO
       funzip(1L),   zip(1L),   zipcloak(1L),  zipgrep(1L),  zip-
       info(1L), zipnote(1L), zipsplit(1L)

URL
       The    Info-ZIP    home    page    is     currently     at
       http://www.cdrom.com/pub/infozip/ .

AUTHORS
       The  primary Info-ZIP authors (current semi-active members
       of  the  Zip-Bugs  workgroup)  are:   Greg  ``Cave  Newt''
       Roelofs  (UnZip);  Onno  van  der  Linden (Zip); Jean-loup
       Gailly (compression); Mark Adler (decompression,  fUnZip);
       Christian  Spieler (UnZip maintance coordination, VMS, MS-
       DOS, Windows 95, NT, shared code, general  Zip  and  UnZip
       integration  and  optimization);  Mike White (Windows GUI,
       Windows DLLs); Kai Uwe Rommel (OS/2); Paul Kienitz (Amiga,
       Windows  95);  Chris Herborth (BeOS, QNX, Atari); Jonathan
       Hudson (SMS/QDOS); Sergio Monesi (Acorn RISC  OS);  Harald
       Denker  (Atari,  MVS);  John Bush (Solaris, Amiga); Hunter
       Goatley (VMS); Steve Salisbury  (Windows  95,  NT);  Steve
       Miller  (Windows  CE GUI), Johnny Lee (MS-DOS, Windows 95,
       NT); and Dave Smith (Tandem NSK).  The author of the orig-
       inal  unzip code upon which Info-ZIP's was based is Samuel
       H. Smith; Carl Mascott did the first Unix port; and  David
       P.   Kirschbaum  organized  and  led Info-ZIP in its early
       days with Keith Petersen hosting the original mailing list
       at  WSMR-SimTel20.  The full list of contributors to UnZip
       has grown quite large; please refer to the  CONTRIBS  file
       in the UnZip source distribution for a relatively complete
       version.
